import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: ListenerExample(), 
        ),
      ),
    );
  }
}

class ListenerExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    //GestureDetector->Listener
    return GestureDetector(
      //onTapUp->onPointerUp
      onTapUp: (_) => print("父组件：PointerUp"), // 父组件使用 Listener
      child: Container(
        width: 200,
        height: 200,
        color: Colors.red,
        child: GestureDetector(
          onTap: () => print("子组件：Tap"), // 子组件使用 GestureDetector
          child: Container(
            width: 50,
            height: 50,
            color: Colors.grey,
          ),
        ),
      ),
    );
  }
}